# Copyright 2018 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
r"""A dummy decorator used for testing.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from morph_net.framework import generic_regularizers


class DummyDecorator(generic_regularizers.OpRegularizer):
  """A dummy decorator that multiply the regularization vector by a scale."""

  def __init__(self, regularizer_object, scale):
    """Creates an instance.

    Accept an OpRegularizer that is decorated by this class.

    Args:
      regularizer_object: OpRegularizer to decorate.
      scale: A float to scale regularization_vector.
    """

    self._regularization_vector = (
        regularizer_object.regularization_vector * scale)
    self._alive_vector = regularizer_object.alive_vector

  @property
  def regularization_vector(self):
    return self._regularization_vector

  @property
  def alive_vector(self):
    return self._alive_vector

